<template>
  <div>
    话题名称：
    <el-input  v-model="topic.topicName"></el-input>
    <br/>
    话题描述：
    <el-input
    type="textarea"
    :rows="2"
    placeholder="请输入内容"
    v-model="topic.topicDescr">
  </el-input>
    <el-button style="float: right;margin-top: 10px" @click="addTopic">发布</el-button>
  </div>

</template>

<script>
export default {
  name: 'AddTopic',
  data () {
    return {
      topic: {
        createTime: '',
        page: 1,
        pageSize: 10,
        sortOrder: '',
        topicDescr: '',
        topicIcon: '',
        topicId: -1,
        topicName: '',
        updateTime: '',
        version: -1
      }
    }
  },
  methods: {
    // 用于改变面包屑导航栏
    changeBread () {
      document.getElementById('first').innerHTML = '话题管理'
      document.getElementById('second').innerHTML = '话题发布'
      document.getElementById('separate_1').innerHTML = '/'
      document.getElementById('separate_2').innerHTML = '/'
    },
    async addTopic () {
      const { data: res } = await this.$http.post('topic/insertTopic', this.topic)
      if (res.status === 200) {
        this.addDialogVisible = false
        return this.$message.success('发布成功！！')
      }
    }
  },
  mounted () {
    this.changeBread()
  }
}
</script>

<style scoped>

</style>
